import request from '../util/request';


interface IUserResponse {
	statusCode: number;
	message: string;
	data: {
		userInfo: UserInfo;
		token: string;
	};
}

interface UserInfo {
	_id: string;
	imageUrl: string;
	isShow: boolean;
	name: string;
	email: string;
	jurisdiction: string[];
}

/**
 * 手机号码登录
 * @param phone
 * @param code
 */
export const phoneLogin = ({ phone, code }): Promise<IUserResponse> => {
	let url = '/api/user/phone-login';
	return request.post(url, { phone, code });
}
